package com.wlyuan.open.scanner.utils.enums.named;

import com.wlyuan.core.marker.NamedValue;
import com.wlyuan.core.marker.NamedValueMap;
import com.wlyuan.core.named.BillingMode;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Map;

/**
 * @author lijing
 * @description
 */
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public enum ChargeModeEnum implements NamedValue<Integer> {

    WEIGHT(1, BillingMode.WEIGHT.getValue(), "重量"),
    VOLUME(2, BillingMode.VOLUME.getValue(), "体积"),
    NUMBER(3, BillingMode.QUANTITY.getValue(), "数量");

    private final Integer value;
    private final Integer newValue;
    private final String name;

    private static final Map<Integer, ChargeModeEnum> MAP = new NamedValueMap<>(ChargeModeEnum.class);

    public static ChargeModeEnum fromValue(Integer value) {
        return MAP.get(value);
    }
}
